package com.yuzhihao.writejvm.read;

import com.yuzhihao.writejvm.format.ClassFormatEnum;

import java.io.*;

/**
 * 读取class文件信息
 *
 * @author yzh
 * @date 2021年11月29日17:45:31
 */
public class ReadClassFile extends DataInputStream {

    public ReadClassFile(InputStream is){
        super(is);
    }


    public byte[] read(ClassFormatEnum cfe) throws IOException {
        byte[] bytes = new byte[cfe.getB()];
        int read = super.read(bytes);
        return read == -1 ? null : bytes;
    }

}
